import time
from selenium import webdriver
from selenium.webdriver.common.by import By

driver = webdriver.Chrome()
driver.get("https://www.baidu.com")

# 定位元素 Xpath标签和属性
kw = driver.find_element(By.XPATH, "//input[@id='kw']")
print(kw.get_attribute("outerHTML"))

s_ipt = driver.find_element(By.XPATH, "//input[@class='s_ipt']")
print(s_ipt.get_attribute("outerHTML"))

KW = driver.find_element(By.XPATH, "//*[@maxlength='255']")
print(kw.get_attribute("outerHTML"))



# 退出浏览器
driver.quit()